# # to use: "make -f crctst.mak" # # Make sure of shell SHELL=/bin/sh # enter output xecutable name here TARGETNAME=crctst # CRC8 CRC10 X25 CRC16 XMODEM MILSTD188 AUTODINII XXX=CRC10 # enter list of source ".c" base names here without extension PROGS=crctst crc # enter source file path here BASEPATH=. # enter output executable path here TARGETPATH=. # compiler CC=gcc # compiler option(s) CCOPT=-g -Wall -D${XXX} #add any include paths here preceeded by -I INCL= #add any library paths here preceeded by -L LIBPATH= # add any libraries here preceeded by "-l" LIBS=-lnsl # build CFLAGS from above CFLAGS=$(INCL) -I$(BASEPATH)/include $(CCOPT) OBJS:=$(PROGS:=.o) CFILES:=$(PROGS:=.c) all: $(TARGETPATH)/$(TARGETNAME) #dependencies $(TARGETNAME)depend.mak : @echo "Building dependencies " $@ " " @echo # dependencies > $(TARGETNAME)depend.mak $(CC) -MM $(INCL) $(CFILES) >> $(TARGETNAME)depend.mak include $(TARGETNAME)depend.mak # compilation rule .c.o: @echo "Compiling " $@ " " $(CC) $(CFLAGS) -c $< #link rule $(TARGETNAME):$(OBJS) @echo "Building " $@ " " $(CC) $(CFLAGS) -o $(TARGETPATH)/$@ $(LIBPATH) $(OBJS) $(LIBS) clean: rm -f $(OBJS) rm -f $(TARGETNAME)depend.mak rm -f $(TARGETPATH)/$(TARGETNAME)