diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 30 | 
1 files changed, 20 insertions, 10 deletions
@@ -1,16 +1,26 @@  CC ?= cc -CFLAGS=-std=c99 -W -Wall -pedantic -O2 -Iinclude -OBJS=fhp.o test.o -APP=./fhp-test +CFLAGS=-std=c99 -W -Wall -pedantic -O2 -Iinclude -fPIC +OBJS=fhp.o +SONAME=libfhp.so +LIB=libfhp.so -all: $(OBJS) -	$(CC) -o $(APP) $(OBJS) +TEST_OBJS=test.o +TEST_APP=./fhp-test +TEST_LDFLAGS=-lfhp -L. -test: all -	$(APP) +all: $(LIB) -%.o: %.c include/fhp/fhp.h -	$(CC) -c $(CFLAGS) $< +test: $(TEST_APP) +	LD_LIBRARY_PATH=. $(TEST_APP)  clean: -	rm -f $(APP) $(OBJS) +	rm -f $(LIB) $(OBJS) $(TEST_APP) $(TEST_OBJS) + +$(LIB): $(OBJS) +	$(CC) -o $(LIB) -shared -Wl,-soname,$(SONAME) $(OBJS) + +$(TEST_APP): $(LIB) $(TEST_OBJS) +	$(CC) -o $(TEST_APP) $(TEST_OBJS) $(TEST_LDFLAGS) + +%.o: %.c include/fhp/fhp.h +	$(CC) -c $(CFLAGS) $<  | 
