Skip to content

Commit

Permalink
simplify makefile with template target; make CC optional
Browse files Browse the repository at this point in the history
  • Loading branch information
amin committed Oct 11, 2020
1 parent 8b69bcc commit aa35774
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
#CFLAGS=-g -fno-diagnostics-color
CC=cc
CC?=cc
LIBS=-lexpat
OBJS=fb2ms.o handler.o element.o util.o

fb2ms: fb2ms.o handler.o element.o util.o
fb2ms: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ -o fb2ms

fb2ms.o: fb2ms.c handler.h element.h
$(CC) $(CFLAGS) -c fb2ms.c

element.o: element.c element.h
$(CC) $(CFLAGS) -c element.c

handler.o: handler.c handler.h element.h
$(CC) $(CFLAGS) -c handler.c

util.o: util.c util.h
$(CC) $(CFLAGS) -c util.c

%.o: %.c %.h
$(CC) $(CFLAGS) -c $< -o $@

clean:
rm -f fb2ms *.o
rm -f fb2ms $(OBJS)

0 comments on commit aa35774

Please sign in to comment.