diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-27 01:56:00 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-27 01:56:00 -0400 |
commit | f51c619c81a8a3b623f13484ea57c9533677d532 (patch) | |
tree | e94421c858f90931aa14092a188613744955edac /Makefile | |
parent | 7a4a5e6f117e2768e7ececc7cf62a2941203adf4 (diff) | |
download | libfhp-f51c619c81a8a3b623f13484ea57c9533677d532.tar.bz2 libfhp-f51c619c81a8a3b623f13484ea57c9533677d532.zip |
clean up makefile
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) $< |