Common Makefile Style NAME += OBJECT
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:50:28 +0200
changeset 66 2b4f786d9073
parent 65 76514757b0d6
child 67 abe63a276a36
Common Makefile Style NAME += OBJECT committer: Markus Bröker <mbroeker@largo.homelinux.org>
.gitignore
Makefile
asm/Makefile
db_bridge/Makefile
ddos/Makefile
libConsole/Makefile
libtest/Makefile
lsflib/Makefile.am
lsflib/tools/Makefile
parser/c_compiler/Makefile
parser/calc/Makefile
pmc/Makefile
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,17 @@
 *.dll
 *.bak
 *.obj
+
+khello/.tmp_versions/
+khello/Module.symvers
+
+lsflib/Makefile.in
+lsflib/aclocal.m4
+lsflib/autom4te.cache/
+lsflib/config.guess
+lsflib/config.sub
+lsflib/configure
+lsflib/depcomp
+lsflib/install-sh
+lsflib/missing
+
--- a/Makefile
+++ b/Makefile
@@ -1,59 +1,60 @@
-CC=gcc -g -ggdb
-CPP=g++ -g -ggdb
-CFLAGS=-Wall -O2 -Iinclude -ansi
-TARGET=ncurses \
-	numerierung \
-	xdemo \
-	signals \
-	tree \
-	utf8 \
-	file_demo \
-	testcase \
-	atoi_print \
-	data_types \
-	dnsresolve \
-	nomalloc \
-	urandom \
-	threads \
-	crypt \
-	tokenpasting \
-	hex2chars \
-	floating \
-	max \
-	recording \
-	endian \
-	fak \
-	blackhole \
-	folge \
-	counter \
-	sudoku \
-	cunit \
-	md5 \
-	md5rec \
-	myprintf \
-	concatenation \
-	alpha_beta \
-	life \
-	bad_alloc \
-	lotto \
-	database \
-	gauss \
-	mem2swap \
-	prog_limit \
-	connection \
-	copy \
-	function_pointers \
-	sort \
-	min2time \
-	recursive_compiler \
-	getpwnam_error \
-	xmlparser \
-	vector \
-	base10 \
-	files \
-	fork \
-	duff \
-	unicode
+     CC = gcc -g -ggdb
+    CPP = g++ -g -ggdb
+ CFLAGS = -Wall -O2 -Iinclude -ansi
+
+TARGET  = ncurses
+TARGET += numerierung
+TARGET += xdemo
+TARGET += signals
+TARGET += tree
+TARGET += utf8
+TARGET += file_demo
+TARGET += testcase
+TARGET += atoi_print
+TARGET += data_types
+TARGET += dnsresolve
+TARGET += nomalloc
+TARGET += urandom
+TARGET += threads
+TARGET += crypt
+TARGET += tokenpasting
+TARGET += hex2chars
+TARGET += floating
+TARGET += max
+TARGET += recording
+TARGET += endian
+TARGET += fak
+TARGET += blackhole
+TARGET += folge
+TARGET += counter
+TARGET += sudoku
+TARGET += cunit
+TARGET += md5
+TARGET += md5rec
+TARGET += myprintf
+TARGET += concatenation
+TARGET += alpha_beta
+TARGET += life
+TARGET += bad_alloc
+TARGET += lotto
+TARGET += database
+TARGET += gauss
+TARGET += mem2swap
+TARGET += prog_limit
+TARGET += connection
+TARGET += copy
+TARGET += function_pointers
+TARGET += sort
+TARGET += min2time
+TARGET += recursive_compiler
+TARGET += getpwnam_error
+TARGET += xmlparser
+TARGET += vector
+TARGET += base10
+TARGET += files
+TARGET += fork
+TARGET += duff
+TARGET += unicode
 
 .SUFFIXES: .c .cc .asm
 
@@ -287,7 +288,7 @@
 	@echo Linking $< ...
 	@$(CC) -std=c99 -o $@ $<
 
-.PHONY: clean uninstall
+.PHONY: beauty clean uninstall
 
 clean:
 	find -name '*~' -exec rm -f {} \;
@@ -297,4 +298,5 @@
 beauty:
 	find -name '*.[ch]' -exec indent {} \;
 	find -name '*.[ch]' -exec eraser {} \;
+	find -name 'Makefile*' -exec eraser {} \;
 	@make clean
--- a/asm/Makefile
+++ b/asm/Makefile
@@ -1,9 +1,10 @@
-CC=gcc -g -ggdb
-CFLAGS=-Wall -O2 -Iinclude
-LDFLAGS=
-NASM=nasm -f elf -Iinclude/
-TARGET=stackinfo
-OBJECTS=main.o get_sp.o
+      CC = gcc -g -ggdb
+  CFLAGS = -Wall -O2 -Iinclude
+ LDFLAGS =
+    NASM = nasm -f elf -Iinclude/
+  TARGET = stackinfo
+OBJECTS  = main.o
+OBJECTS += get_sp.o
 
 .SUFFIXES: .c .asm
 
@@ -36,4 +37,3 @@
 uninstall:
 	rm -f ~/bin/decimal
 	rm -f ~/bin/$(TARGET)
-
--- a/db_bridge/Makefile
+++ b/db_bridge/Makefile
@@ -1,12 +1,11 @@
-CC=g++
-CFLAGS=-Wall -O2 -ansi -Iinclude
-TARGET=\
-	mysql_db \
-	postgresql_db
+      CC = g++
+  CFLAGS = -Wall -O2 -ansi -Iinclude
 
-OBJECTS=\
-	main.o \
-	console.o
+ TARGET += mysql_db
+ TARGET += postgresql_db
+
+OBJECTS  = main.o
+OBJECTS += console.o
 
 .SUFFIXES: .cpp
 
--- a/ddos/Makefile
+++ b/ddos/Makefile
@@ -1,9 +1,14 @@
-CC=gcc -g -ggdb
-CFLAGS=-Wall -O2 -Iinclude -ansi
-NASM=nasm -f elf -Iinclude/
-TARGET=client server
-SOBJECTS=server.o set_limit.o
-COBJECTS=client.o
+       CC = gcc -g -ggdb
+   CFLAGS = -Wall -O2 -Iinclude -ansi
+     NASM = nasm -f elf -Iinclude/
+
+  TARGET  = client
+  TARGET += server
+
+SOBJECTS  = server.o
+SOBJECTS += set_limit.o
+
+COBJECTS  = client.o
 
 .SUFFIXES: .c .asm
 
--- a/libConsole/Makefile
+++ b/libConsole/Makefile
@@ -1,8 +1,8 @@
-CC=gcc
-JAVA=java
-JAVAH=javah
-JAVAC=javac
-LIB=lib/libConsole.so
+   CC = gcc
+ JAVA = java
+JAVAH = javah
+JAVAC = javac
+  LIB = lib/libConsole.so
 
 ifdef JAVA_HOME
 	JAVA_DIR="$(JAVA_HOME)"
@@ -10,13 +10,12 @@
 	JAVA_DIR=/usr/lib/jvm/java-6-sun
 endif
 
-INCLUDE=-I$(JAVA_DIR)/include -I$(JAVA_DIR)/include/linux -Iinclude
-SOURCES= \
-	Getch.java \
-	Console.java
+INCLUDE = -I$(JAVA_DIR)/include -I$(JAVA_DIR)/include/linux -Iinclude
 
-OBJECTS= \
-	cross_getch.o
+SOURCES  = Getch.java
+SOURCES += Console.java
+
+OBJECTS  = cross_getch.o
 
 .SUFFIXES: .java
 
--- a/libtest/Makefile
+++ b/libtest/Makefile
@@ -1,5 +1,5 @@
      CC = gcc
- CFLAGS =-Wall -O2 -fPIC
+ CFLAGS = -Wall -O2 -fPIC
 LDFLAGS = -Llib -ltest
 OBJECTS = func1.o func2.o
 
--- a/lsflib/Makefile.am
+++ b/lsflib/Makefile.am
@@ -1,24 +1,24 @@
-AUTOMAKE_OPTIONS 			= gnu
-AM_CFLAGS 					= -Iinclude
-lib_LTLIBRARIES 			= liblsf.la
-liblsf_la_SOURCES			= \
-					src/bindump.c \
-					src/getdir.c \
-					src/get_line.c \
-					src/hexdump.c \
-					src/list.c \
-					src/md5recursive.c \
-					src/md5sum.c \
-					src/not.c \
-					src/tokenchar.c \
-					src/tokenizer.c \
-					src/xor.c
+  AUTOMAKE_OPTIONS = gnu
+         AM_CFLAGS = -Iinclude
+   lib_LTLIBRARIES = liblsf.la
 
-liblsf_ladir 				= $(prefix)/include
-liblsf_la_HEADERS 			= \
-					include/bits.h \
-					include/cpuid.h \
-					include/list.h \
-					include/lsf.h 
+liblsf_la_SOURCES  = src/bindump.c
+liblsf_la_SOURCES += src/getdir.c
+liblsf_la_SOURCES += src/get_line.c
+liblsf_la_SOURCES += src/hexdump.c
+liblsf_la_SOURCES += src/list.c
+liblsf_la_SOURCES += src/md5recursive.c
+liblsf_la_SOURCES += src/md5sum.c
+liblsf_la_SOURCES += src/not.c
+liblsf_la_SOURCES += src/tokenchar.c
+liblsf_la_SOURCES += src/tokenizer.c
+liblsf_la_SOURCES += src/xor.c
 
-liblsf_la_LDFLAGS 			= -version-info 0:58:0
+      liblsf_ladir = $(prefix)/include
+
+liblsf_la_HEADERS  = include/bits.h
+liblsf_la_HEADERS += include/cpuid.h
+liblsf_la_HEADERS += include/list.h
+liblsf_la_HEADERS += include/lsf.h
+
+ liblsf_la_LDFLAGS = -version-info 0:58:0
--- a/lsflib/tools/Makefile
+++ b/lsflib/tools/Makefile
@@ -1,20 +1,26 @@
-CC		= gcc
-CPP		= g++
-STRIP		= strip -s
-INSTALL		= cp -f
-RM		= rm -f
-CFLAGS		= -Wall -Wstrict-prototypes 
-INCLUDE		= -I/usr/local/include
-LDFLAGS		= -L/usr/local/lib/ -llsf -Wl,--rpath,lib
+      CC = gcc
+     CPP = g++
+   STRIP = strip -s
+ INSTALL = cp -f
+      RM = rm -f
+  CFLAGS = -Wall -Wstrict-prototypes
+ INCLUDE = -I/usr/local/include
+ LDFLAGS = -L/usr/local/lib/ -llsf -Wl,--rpath,lib
 
-TARGET		= progs
+OBJECTS  = cpuid.o
+OBJECTS += main.o
+OBJECTS += digest.o
+OBJECTS += dump.o
+OBJECTS += list.o
+
+TARGET = progs
 
 .c.o:
 	$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
 
 all: progs
 
-progs: cpuid.o main.o digest.o dump.o list.o
+progs: $(OBJECTS)
 	$(CC) $(LDFLAGS) digest.o -o digest
 	$(CC) $(LDFLAGS) dump.o -o dump
 	$(CC) $(LDFLAGS) cpuid.o main.o -o cpuid
@@ -27,12 +33,12 @@
 
 .PHONY: clean distclean
 
-clean: 
+clean:
 	$(RM) *.o
 	$(RM) *~
 	$(RM) digest cpuid dump list
 
-distclean: 
+distclean:
 	@make clean
 
 install: progs
@@ -41,9 +47,8 @@
 	$(INSTALL) dump $(HOME)/bin/
 	$(INSTALL) list $(HOME)/bin/
 
-uninstall: 
+uninstall:
 	$(RM) $(HOME)/bin/digest
 	$(RM) $(HOME)/bin/list
 	$(RM) $(HOME)/bin/cpuid
 	$(RM) $(HOME)/bin/dump
-
--- a/parser/c_compiler/Makefile
+++ b/parser/c_compiler/Makefile
@@ -1,17 +1,21 @@
-CC=gcc
-LD=ld
-YACC=bison -v
-FLEX=flex
-CFLAGS=-Wall -O2 -ansi -D_XOPEN_SOURCE=500
-LDFLAGS=
-INCLUDE=include
-OBJECTS=main.o parser.o lexer.o
+      CC = gcc
+      LD = ld
+    YACC = bison -v
+    FLEX = flex
+  CFLAGS = -Wall -O2 -ansi -D_XOPEN_SOURCE=500
+ LDFLAGS =
+ INCLUDE = -Iinclude
+
+OBJECTS  = main.o
+OBJECTS += parser.o
+OBJECTS += lexer.o
+
 TARGET=mcc
 
 .SUFFIXES: .c .y .l
 
 .c.o:
-	$(CC) -c $(CFLAGS) -I$(INCLUDE) $(CONFIG) $<
+	$(CC) -c $(CFLAGS) $(INCLUDE) $(CONFIG) $<
 
 .y.c:
 	$(YACC) -d $< -o $@
--- a/parser/calc/Makefile
+++ b/parser/calc/Makefile
@@ -1,17 +1,21 @@
-CC=gcc
-LD=ld
-YACC=bison -y
-FLEX=flex
-CFLAGS=-Wall -O2 -ansi -D_XOPEN_SOURCE=500
-LDFLAGS=
-INCLUDE=include
-OBJECTS=main.o parser.o lexer.o
-TARGET=calc
+      CC = gcc
+      LD = ld
+    YACC = bison -y
+    FLEX = flex
+  CFLAGS = -Wall -O2 -ansi -D_XOPEN_SOURCE=500
+ LDFLAGS =
+ INCLUDE = -Iinclude
+
+OBJECTS  = main.o
+OBJECTS += parser.o
+OBJECTS += lexer.o
+
+TARGET = calc
 
 .SUFFIXES: .c .y .l
 
 .c.o:
-	$(CC) -c $(CFLAGS) -I$(INCLUDE) $(CONFIG) $<
+	$(CC) -c $(CFLAGS) $(INCLUDE) $(CONFIG) $<
 
 .y.c:
 	$(YACC) -d $< -o $@
--- a/pmc/Makefile
+++ b/pmc/Makefile
@@ -1,11 +1,17 @@
-CC=g++ -g -ggdb
-CFLAGS=-Wall -O2 -ansi
-LDFLAGS=-lSDL
-INCLUDE=include
-CONFIG=-DSTEP=10
+      CC = g++ -g -ggdb
+  CFLAGS = -Wall -O2 -ansi
+ LDFLAGS = -lSDL
+ INCLUDE = include
+  CONFIG = -DSTEP=10
 
-OBJECTS=object.o surface.o vector.o rectangle.o cube.o main.o
-TARGET=pmc
+OBJECTS  = object.o
+OBJECTS += surface.o
+OBJECTS += vector.o
+OBJECTS += rectangle.o
+OBJECTS += cube.o
+OBJECTS += main.o
+
+ TARGET  = pmc
 
 .SUFFIXES: .cc