]> git.sur5r.net Git - i3/i3/commitdiff
*.mk: Support passing specific CFLAGS/LIBS
authorQuentin Glidic <sardemff7+git@sardemff7.net>
Sun, 22 Jul 2012 20:04:14 +0000 (22:04 +0200)
committerQuentin Glidic <sardemff7+git@sardemff7.net>
Sun, 22 Jul 2012 21:53:13 +0000 (23:53 +0200)
i3-config-wizard/i3-config-wizard.mk
i3-dump-log/i3-dump-log.mk
i3-input/i3-input.mk
i3-msg/i3-msg.mk
i3-nagbar/i3-nagbar.mk
i3bar/i3bar.mk
libi3/libi3.mk
src/i3.mk

index ed41941b0b28828ed6659a0d79a658a441b6aa85..583047e7787188b9dd54622aedd725e41df5d986 100644 (file)
@@ -2,16 +2,18 @@ ALL_TARGETS += i3-config-wizard/i3-config-wizard
 INSTALL_TARGETS += install-i3-config-wizard
 CLEAN_TARGETS += clean-i3-config-wizard
 
-i3_config_wizard_SOURCES_GENERATED = i3-config-wizard/cfgparse.tab.c i3-config-wizard/cfgparse.yy.c
-i3_config_wizard_SOURCES := $(filter-out $(i3_config_wizard_SOURCES_GENERATED),$(wildcard i3-config-wizard/*.c))
-i3_config_wizard_HEADERS := $(wildcard i3-config-wizard/*.h)
+i3_config_wizard_SOURCES_GENERATED  = i3-config-wizard/cfgparse.tab.c i3-config-wizard/cfgparse.yy.c
+i3_config_wizard_SOURCES           := $(filter-out $(i3_config_wizard_SOURCES_GENERATED),$(wildcard i3-config-wizard/*.c))
+i3_config_wizard_HEADERS           := $(wildcard i3-config-wizard/*.h)
+i3_config_wizard_CFLAGS             =
+i3_config_wizard_LIBS               =
 
 i3_config_wizard_OBJECTS := $(i3_config_wizard_SOURCES_GENERATED:.c=.o) $(i3_config_wizard_SOURCES:.c=.o)
 
 
 i3-config-wizard/%.o: i3-config-wizard/%.c $(i3_config_wizard_HEADERS)
        echo "[i3-config-wizard] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3_config_wizard_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 i3-config-wizard/cfgparse.yy.c: i3-config-wizard/cfgparse.l i3-config-wizard/cfgparse.tab.o $(i3_config_wizard_HEADERS)
        echo "[i3-config-wizard] LEX $<"
@@ -23,7 +25,7 @@ i3-config-wizard/cfgparse.tab.c: i3-config-wizard/cfgparse.y $(i3_config_wizard_
 
 i3-config-wizard/i3-config-wizard: libi3.a $(i3_config_wizard_OBJECTS)
        echo "[i3-config-wizard] Link i3-config-wizard"
-       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3_config_wizard_LIBS) $(LIBS)
 
 install-i3-config-wizard: i3-config-wizard/i3-config-wizard
        echo "[i3-config-wizard] Install"
index a29bced46a89230384b8f2dbce936d283ac14837..80bd86cc73ef4a1ffb7e6cbf5c7c1ec5a89918de 100644 (file)
@@ -4,17 +4,19 @@ CLEAN_TARGETS += clean-i3-dump-log
 
 i3_dump_log_SOURCES := $(wildcard i3-dump-log/*.c)
 i3_dump_log_HEADERS := $(wildcard i3-dump-log/*.h)
+i3_dump_log_CFLAGS   =
+i3_dump_log_LIBS     =
 
 i3_dump_log_OBJECTS := $(i3_dump_log_SOURCES:.c=.o)
 
 
 i3-dump-log/%.o: i3-dump-log/%.c $(i3_dump_log_HEADERS)
        echo "[i3-dump-log] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3_dump_log_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 i3-dump-log/i3-dump-log: libi3.a $(i3_dump_log_OBJECTS)
        echo "[i3-dump-log] Link i3-dump-log"
-       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3_dump_log_LIBS) $(LIBS)
 
 install-i3-dump-log: i3-dump-log/i3-dump-log
        echo "[i3-dump-log] Install"
index 35c7496498b8365092896141033da8fe67d0648c..e7ce6339ff8fb4428784656938017f2031115c3a 100644 (file)
@@ -4,17 +4,19 @@ CLEAN_TARGETS += clean-i3-input
 
 i3_input_SOURCES := $(wildcard i3-input/*.c)
 i3_input_HEADERS := $(wildcard i3-input/*.h)
+i3_input_CFLAGS   =
+i3_input_LIBS     =
 
 i3_input_OBJECTS := $(i3_input_SOURCES:.c=.o)
 
 
 i3-input/%.o: i3-input/%.c $(i3_input_HEADERS)
        echo "[i3-input] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3_input_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 i3-input/i3-input: libi3.a $(i3_input_OBJECTS)
        echo "[i3-input] Link i3-input"
-       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3_input_LIBS) $(LIBS)
 
 install-i3-input: i3-input/i3-input
        echo "[i3-input] Install"
index 9526dc04dddfbdfc43c44a645547cd3d71ebafb1..cdd44987604a7155da9c71943701ddf5b9a2196f 100644 (file)
@@ -4,17 +4,19 @@ CLEAN_TARGETS += clean-i3-msg
 
 i3_msg_SOURCES := $(wildcard i3-msg/*.c)
 i3_msg_HEADERS := $(wildcard i3-msg/*.h)
+i3_msg_CFLAGS   =
+i3_msg_LIBS     =
 
 i3_msg_OBJECTS := $(i3_msg_SOURCES:.c=.o)
 
 
 i3-msg/%.o: i3-msg/%.c $(i3_msg_HEADERS)
        echo "[i3-msg] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3_msg_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 i3-msg/i3-msg: libi3.a $(i3_msg_OBJECTS)
        echo "[i3-msg] Link i3-msg"
-       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3_msg_LIBS) $(LIBS)
 
 install-i3-msg: i3-msg/i3-msg
        echo "[i3-msg] Install"
index 9677b808f5012f78f48a09ef1a1bb5dce50cb829..78f77d43f7aa9029ce344db67f51a62c527e7f68 100644 (file)
@@ -4,17 +4,19 @@ CLEAN_TARGETS += clean-i3-nagbar
 
 i3_nagbar_SOURCES := $(wildcard i3-nagbar/*.c)
 i3_nagbar_HEADERS := $(wildcard i3-nagbar/*.h)
+i3_nagbar_CFLAGS   =
+i3_nagbar_LIBS     =
 
 i3_nagbar_OBJECTS := $(i3_nagbar_SOURCES:.c=.o)
 
 
 i3-nagbar/%.o: i3-nagbar/%.c $(i3_nagbar_HEADERS)
        echo "[i3-nagbar] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3_nagbar_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 i3-nagbar/i3-nagbar: libi3.a $(i3_nagbar_OBJECTS)
        echo "[i3-nagbar] Link i3-nagbar"
-       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3_nagbar_LIBS) $(LIBS)
 
 install-i3-nagbar: i3-nagbar/i3-nagbar
        echo "[i3-nagbar] Install"
index 3f16f8a2b973dd2f39ea56f345e8aa87848ca5eb..776961c9323620c538251249a491449d08fa18cf 100644 (file)
@@ -4,17 +4,19 @@ CLEAN_TARGETS += clean-i3bar
 
 i3bar_SOURCES := $(wildcard i3bar/src/*.c)
 i3bar_HEADERS := $(wildcard i3bar/include/*.h)
+i3bar_CFLAGS   =
+i3bar_LIBS     =
 
 i3bar_OBJECTS := $(i3bar_SOURCES:.c=.o)
 
 
 i3bar/src/%.o: i3bar/src/%.c $(i3bar_HEADERS)
        echo "[i3bar] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -Ii3bar/include -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3bar_CFLAGS) $(CFLAGS) -Ii3bar/include -c -o $@ $<
 
 i3bar/i3bar: libi3.a $(i3bar_OBJECTS)
        echo "[i3bar] Link i3bar"
-       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3bar_LIBS) $(LIBS)
 
 install-i3bar: i3bar/i3bar
        echo "[i3bar] Install"
index 9c9f3c91d2ea33939073e4f6718b142807095740..bf7b764301251698ef03eb6895a4662e2d9bf74f 100644 (file)
@@ -2,17 +2,19 @@ CLEAN_TARGETS += clean-libi3
 
 libi3_SOURCES := $(wildcard libi3/*.c)
 libi3_HEADERS := $(wildcard libi3/*.h)
+libi3_CFLAGS   =
+libi3_LIBS     =
 
 libi3_OBJECTS := $(libi3_SOURCES:.c=.o)
 
 
 libi3/%.o: libi3/%.c $(libi3_HEADERS)
        echo "[libi3] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(libi3_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 libi3.a: $(libi3_OBJECTS)
        echo "[libi3] AR libi3.a"
-       ar rcs $@ $^
+       ar rcs $@ $^ $(libi3_LIBS)
 
 clean-libi3:
        echo "[libi3] Clean"
index 026bf4a0c82023ddf51b52085db3783ef7b0f60f..5f05b0cc21654199d64efdc77da4bc5e7719a98c 100644 (file)
--- a/src/i3.mk
+++ b/src/i3.mk
@@ -2,16 +2,18 @@ ALL_TARGETS += i3
 INSTALL_TARGETS += install-i3
 CLEAN_TARGETS += clean-i3
 
-i3_SOURCES_GENERATED = src/cfgparse.tab.c src/cfgparse.yy.c
-i3_SOURCES := $(filter-out $(i3_SOURCES_GENERATED),$(wildcard src/*.c))
+i3_SOURCES_GENERATED  = src/cfgparse.tab.c src/cfgparse.yy.c
+i3_SOURCES           := $(filter-out $(i3_SOURCES_GENERATED),$(wildcard src/*.c))
 i3_HEADERS_CMDPARSER := $(wildcard include/GENERATED_*.h)
-i3_HEADERS := $(filter-out $(i3_HEADERS_CMDPARSER),$(wildcard include/*.h))
+i3_HEADERS           := $(filter-out $(i3_HEADERS_CMDPARSER),$(wildcard include/*.h))
+i3_CFLAGS             =
+i3_LIBS               =
 
 i3_OBJECTS := $(i3_SOURCES_GENERATED:.c=.o) $(i3_SOURCES:.c=.o)
 
 src/%.o: src/%.c $(i3_HEADERS)
        echo "[i3] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 src/cfgparse.yy.c: src/cfgparse.l src/cfgparse.tab.o $(i3_HEADERS)
        echo "[i3] LEX $<"
@@ -26,8 +28,8 @@ src/cfgparse.tab.c: src/cfgparse.y $(i3_HEADERS)
 # and once as an object file for i3.
 src/commands_parser.o: src/commands_parser.c $(i3_HEADERS) i3-command-parser.stamp
        echo "[i3] CC $<"
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DTEST_PARSER -o test.commands_parser $< $(LIBS)
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CPPFLAGS) $(i3_CFLAGS) $(CFLAGS) $(LDFLAGS) -DTEST_PARSER -o test.commands_parser $< $(i3_LIBS) $(LIBS)
+       $(CC) $(CPPFLAGS) $(i3_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 i3-command-parser.stamp: generate-command-parser.pl parser-specs/commands.spec
        echo "[i3] Generating command parser"
@@ -36,7 +38,7 @@ i3-command-parser.stamp: generate-command-parser.pl parser-specs/commands.spec
 
 i3: libi3.a $(i3_OBJECTS)
        echo "[i3] Link i3"
-       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3_LIBS) $(LIBS)
 
 install-i3: i3
        echo "[i3] Install"