summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--config.mk21
2 files changed, 21 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 484a85e..0a9ca1a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ include config.mk
-include $(DEPS)
all: $(TARGET)
+debug: $(DTARGET)
options:
@echo "$(PROJECT) build options:"
@@ -12,16 +13,23 @@ options:
@echo "CC = $(CC)"
src/hints.o: src/hints.js.h
+src/hints.do: src/hints.js.h
+
src/hints.js.h: src/hints.js
@echo "minify $<"
@cat $< | src/js2h.sh > $@
$(OBJ): src/config.h config.mk
+$(DOBJ): src/config.h config.mk
$(TARGET): $(OBJ)
@echo "$(CC) $@"
@$(CC) $(OBJ) -o $(TARGET) $(LDFLAGS)
+$(DTARGET): $(DOBJ)
+ @echo "$(CC) $@"
+ @$(CC) $(DFLAGS) $(DOBJ) -o $(DTARGET) $(DLDFLAGS)
+
src/config.h:
@echo create $@ from src/config.def.h
@cp src/config.def.h $@
@@ -30,12 +38,6 @@ src/config.h:
@echo "${CC} $<"
@$(CC) -c -o $@ $< $(CFLAGS)
-debug: $(DTARGET)
-
-$(DTARGET): $(DOBJ)
- @echo "$(CC) $@"
- @$(CC) $(DFLAGS) $(DOBJ) -o $(DTARGET) $(LDFLAGS)
-
%.do: %.c %.h
@echo "${CC} $<"
@$(CC) -c -o $@ $< $(DFLAGS)
diff --git a/config.mk b/config.mk
index 0f85b60..e11bf30 100644
--- a/config.mk
+++ b/config.mk
@@ -30,14 +30,19 @@ ifeq ($(USEGTK3), 1)
CPPFLAGS += -DHAS_GTK3
endif
-CFLAGS += $(shell pkg-config --cflags $(LIBS))
-CFLAGS += -Wall -pipe -ansi -std=c99 -pedantic
-CFLAGS += -Wmissing-declarations -Wmissing-parameter-type -Wno-overlength-strings
-CFLAGS += ${CPPFLAGS}
-
-LDFLAGS += $(shell pkg-config --libs $(LIBS)) -lX11 -lXext -lm
-
-DFLAGS += $(CFLAGS) -DDEBUG -ggdb -g
+# prepare the lib flags used for the linker
+LIBFLAGS = $(shell pkg-config --libs $(LIBS)) -lX11 -lXext -lm
+
+# normal compiler flags
+CFLAGS += $(shell pkg-config --cflags $(LIBS))
+CFLAGS += -Wall -pipe -ansi -std=c99 -pedantic
+CFLAGS += -Wmissing-declarations -Wmissing-parameter-type -Wno-overlength-strings
+CFLAGS += ${CPPFLAGS}
+LDFLAGS += -s ${LIBFLAGS}
+
+# compiler flags for the debug target
+DFLAGS += $(CFLAGS) -DDEBUG -ggdb -g
+DLDFLAGS += ${LIBFLAGS}
OBJ = $(patsubst %.c, %.o, $(wildcard src/*.c))
DOBJ = $(patsubst %.c, %.do, $(wildcard src/*.c))