diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..406caee --- /dev/null +++ b/src/Makefile @@ -0,0 +1,47 @@ +BASEDIR=.. +include $(BASEDIR)/config.mk + +OBJ = $(patsubst %.c, %.o, $(wildcard *.c)) +LOBJ = $(patsubst %.c, %.lo, $(wildcard *.c)) + +all: $(TARGET) + +clean: clean-lib + $(RM) $(TARGET) *.o *.lo hints.js.h + +clean-lib: + $(RM) $(LIBTARGET) + +hints.o: hints.js.h +hints.lo: hints.js.h + +hints.js.h: hints.js + @echo "minify $<" + @cat $< | ./js2h.sh > $@ + +$(OBJ): config.h $(BASEDIR)/config.mk +$(LOBJ): config.h $(BASEDIR)/config.mk + +$(TARGET): $(OBJ) + @echo "$(CC) $@" + @$(CC) $(OBJ) -o $@ $(LDFLAGS) + +$(LIBTARGET): $(LOBJ) + @echo "$(CC) $@" + @$(CC) -shared ${LOBJ} -o $@ $(LDFLAGS) + +config.h: + @echo create $@ from config.def.h + @cp config.def.h $@ + +%.o: %.c %.h + @echo "${CC} $@" + @$(CC) $(CFLAGS) -c -o $@ $< + +%.lo: %.c %.h + @echo "${CC} $@" + @$(CC) -DTESTLIB $(CFLAGS) -fPIC -c -o $@ $< + +-include $(OBJ:.o=.d) + +.PHONY: all clean clean-lib |