.SUFFIXES: .o .h .c .cpp .cxx AR = /usr/bin/ar # Preamble: sets up source and object extensions, compiler, include flags # SCXT = c OBXT = o LBXT = a # # Linux # CC = gcc INCLUDE = -I. \ -I/usr/include/ \ -I/usr/local/include/ # # C Flags (common) # CFPGMRB = -DPBMPLUS_RAWBITS # needed for pnm/ppm/pgm i/o CFLDBUG = -g # debugger info # # C Flags (Linux) # CFLLINX = -DLINUX CFLNTFW = -Wno-non-template-friend CFLAGS = $(CFLLINX) $(CFPGMRB) $(CFLDBUG) $(CFLGDDC) $(CFLNTFW) # # Load libraries # LDFLAGS = -L./ LDLIBS = # # Source files # SRCS = \ serial.$(SCXT) # # Object files # OBJS = \ serial.$(OBXT) # # Conversion rule: source_extension -> object extension # .$(SCXT).$(OBXT): ; $(CC) -c $(CFLAGS) $(INCLUDE) -o $*.$(OBXT) $*.$(SCXT) # # Main target # all: libserial # # Target libraries # libserial: libserial.$(LBXT) libserial.$(LBXT): $(OBJS) $(AR) rc $@ $? # # Extra targets # backup: cp Makefile *.fl *.h *.c *.cxx Backup neat: rm -f *.$(OBXT) core clean: rm -f *.$(OBXT) *.$(LBXT) core main libserial.a # Make dependencies: grep for "#include" lines in ${SRCS}, append to Makefile # depend: dep dep: Makefile.dep makedepend -f Makefile.dep -- $(INCLUDE) -- $(INCFLAGS) -I/usr/include/CC $(SRCS) Makefile.dep: touch Makefile.dep include Makefile.dep