# ----------------------------------------------------------------------- # Makefile for sort index utility # # Creation : 11.03.2012 # Last Modified: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Tool settings # ---------------------------------------------------------------------- # Tools CC = gcc # unicode support CFLAGS += -Wall -Wstrict-prototypes -g # linker LDFLAGS = # ---------------------------------------------------------------------- # Objetcs to build # ---------------------------------------------------------------------- # output files OUTPUT = sortidx # files C_OBJECTS = main.o # ---------------------------------------------------------------------- # Rules # ---------------------------------------------------------------------- # compile targets all: $(OUTPUT) $(OUTPUT): $(C_OBJECTS) @echo "linking $@ ..." @$(CC) -o $@ $^ $(LDFLAGS) # include dependencies -include $(C_OBJECTS:.o=.d) # pattern build rule %.o: %.c @echo "building $*.c ..." @$(CC) -c $(CFLAGS) $*.c -o $*.o @$(CC) -MM $(CFLAGS) $*.c > $*.d @mv -f $*.d $*.d.tmp @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @cp -f $*.d $*.d.tmp @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d @rm -f $*.d.tmp # install and uninstall install: $(OUTPUT) @echo "installing $(OUTPUT)..." @strip $(OUTPUT) @cp $(OUTPUT) /var/install/bin # clean build directory clean : @echo "cleaning up build directory ..." @rm -f *.o @rm -f *.d @rm -f *.cui