Factorize Makefiles rules

This commit is contained in:
Hugues Hiegel 2016-09-09 18:31:53 +02:00 committed by Richard Bérichon
parent f570b2e071
commit 8e25b218ad
2 changed files with 17 additions and 34 deletions

View File

@ -1,20 +1,14 @@
all: cit citin flashprog modt ddtest setmod ddflash setmod2 pls setmod3 PTHREAD_BINS=cit modt
INCLUDE_BINS=setmod setmod2 setmod3
STANDARD_BINS=flashprog ddtest ddflash pls
cit: cit.c all: $(PTHREAD_BINS) $(INCLUDE_BINS) $(STANDARD_BINS)
$(CC) -o cit cit.c -lpthread
modt: modt.c $(PTHREAD_BINS): %: %.c
$(CC) -o modt modt.c -lpthread gcc -o $@ $< -lpthread
setmod: setmod.c $(STANDARD_BINS): %: %.c
$(CC) -o setmod setmod.c -I../include/ gcc -o $@ $<
setmod2: setmod2.c
$(CC) -o setmod2 setmod2.c -I../include/
setmod3: setmod3.c
$(CC) -o setmod3 setmod3.c -I../include/
%.o: %.c
$(CC) $(CFLAGS) -o $@ $<
$(INCLUDE_BINS): %: %.c
gcc -o $@ $< -I../include

View File

@ -1,20 +1,9 @@
all: ddtest octonet octokey ddflash PROGS=ddtest octonet octokey ddflash
all: $(PROGS)
install: all install: $(subst,$(PROGS),%,install-%)
install -m 0755 ddtest $(DESTDIR)/usr/bin $(subst,$(PROGS),%,install-%): install-%: %
install -m 0755 octonet $(DESTDIR)/usr/bin install -m 0755 $< $(DESTDIR)/usr/bin
install -m 0755 octokey $(DESTDIR)/usr/bin
install -m 0755 ddflash $(DESTDIR)/usr/bin
ddflash: ddflash.c
$(CC) -o ddflash ddflash.c
ddtest: ddtest.c
$(CC) -o ddtest ddtest.c
octonet: octonet.c
$(CC) -o octonet octonet.c
octokey: octokey.c
$(CC) -o octokey octokey.c
$(PROGS): %: %.c
$(CC) -o $@ $<