--- Makefile.orig 2014-04-26 01:07:05.381866626 -0700 +++ Makefile 2014-04-26 01:19:01.457333201 -0700 @@ -1,14 +1,14 @@ SHAREDOPT = -shared -LIBDIR = /usr/lib -INCDIR = /usr/include +LIBDIR = $(PREFIX)/usr/lib +INCDIR = $(PREFIX)/include AR = ar -CC = gcc +CC?= gcc INCS = -Iinclude/ -I. -FLAGS = -Wall +CFLAGS += -Wall all: obj/ecgi.o obj/ecgitk.o libecgi.a - make -C html2h/ - make libecgi.so + $(MAKE) -C html2h/ + $(MAKE) libecgi.so shared: libecgi.so cp libecgi.so /usr/lib @@ -18,33 +18,42 @@ ar rs libecgi.a obj/ecgi.o obj/memfile.o obj/ecgitk.o printf "\n\n***congratulations - compilation worked***\n*** run 'make install' now ***\n\n" -libecgi.so: obj/ecgi.o obj/ecgitk.o - gcc $(SHAREDOPT) obj/ecgi.o obj/memfile.o obj/ecgitk.o -o libecgi.so +libecgi.so: obj/ecgi.So obj/ecgitk.So obj/memfile.So + $(CC) $(SHAREDOPT) obj/ecgi.So obj/memfile.So obj/ecgitk.So -o libecgi.so install: cp libecgi.a $(LIBDIR) cp ecgi.h $(INCDIR) cp include/memfile.h $(INCDIR) cp ecgitk.h $(INCDIR) - make -C html2h/ install + $(MAKE) -C html2h/ install cp libecgi.so $(LIBDIR) tests: all - $(CC) tests/test.c -o tests/test.cgi $(INCS) $(FLAGS) libecgi.a - $(CC) tests/testload.c -o tests/testload libecgi.a $(INCS) $(FLAGS) + $(CC) tests/test.c -o tests/test.cgi $(INCS) $(CFLAGS) libecgi.a + $(CC) tests/testload.c -o tests/testload libecgi.a $(INCS) $(CFLAGS) obj/ecgi.o: src/ecgi.c ecgi.h obj/memfile.o - $(CC) -c src/ecgi.c $(INCS) $(FLAGS) -o obj/ecgi.o + $(CC) -c src/ecgi.c $(INCS) $(CFLAGS) -o obj/ecgi.o obj/memfile.o: src/memfile.c include/memfile.h - $(CC) -o obj/memfile.o -c src/memfile.c $(INCS) $(FLAGS) + $(CC) -o obj/memfile.o -c src/memfile.c $(INCS) $(CFLAGS) obj/ecgitk.o: src/ecgitk.c ecgitk.h - $(CC) -c src/ecgitk.c $(INCS) $(FLAGS) -o obj/ecgitk.o + $(CC) -c src/ecgitk.c $(INCS) $(CFLAGS) -o obj/ecgitk.o + +obj/ecgi.So: src/ecgi.c ecgi.h obj/memfile.o + $(CC) -c src/ecgi.c $(INCS) $(CFLAGS) -fPIC -o obj/ecgi.So + +obj/memfile.So: src/memfile.c include/memfile.h + $(CC) -o obj/memfile.So -c src/memfile.c -fPIC $(INCS) $(CFLAGS) + +obj/ecgitk.So: src/ecgitk.c ecgitk.h + $(CC) -c src/ecgitk.c $(INCS) $(CFLAGS) -fPIC -o obj/ecgitk.So clean: rm -f obj/* *.a *.so -f tests/test.cgi tests/testload - make -C html2h/ clean + $(MAKE) -C html2h/ clean zip: clean rm -f ../ecgi-0.6.2.zip