aboutsummaryrefslogtreecommitdiffstats
path: root/bs.mk
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-09-06 09:26:51 +0000
committerEric Wong <normalperson@yhbt.net>2006-09-06 09:26:51 +0000
commit412cb1ee105a74999a3ffac4e60e6602c5f2e541 (patch)
treefc8b9e117fc3ff5eaf0f55113be9dc89418b7a6f /bs.mk
parent7b6d45f50fa49f4da56cc4ae29758a01ec958792 (diff)
downloadmpd-412cb1ee105a74999a3ffac4e60e6602c5f2e541.tar.gz
mpd-412cb1ee105a74999a3ffac4e60e6602c5f2e541.tar.xz
mpd-412cb1ee105a74999a3ffac4e60e6602c5f2e541.zip
bs: a work in progress..
git-svn-id: https://svn.musicpd.org/mpd/trunk@4737 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--bs.mk60
1 files changed, 60 insertions, 0 deletions
diff --git a/bs.mk b/bs.mk
new file mode 100644
index 000000000..2fadffc94
--- /dev/null
+++ b/bs.mk
@@ -0,0 +1,60 @@
+#!/usr/bin/make -f
+# default target
+all:
+
+export CPP CC CPPFLAGS CFLAGS LD LDFLAGS UNAME_S UNAME_M HOST TARGET O
+
+# output directory can be set with O:=dir
+ifeq ($(O),)
+ O := .
+endif
+
+UNAME_S := $(shell uname -s 2>/dev/null || echo unknown)
+UNAME_M := $(shell uname -m 2>/dev/null || echo unknown)
+HOST := $(UNAME_S)-$(UNAME_M)
+TARGET := $(HOST)
+
+include src/Makefile.am
+
+CFLAGS += -I $(O)/src
+mpd_SRC := $(addprefix src/,$(filter %.c,$(mpd_SOURCES)))
+mpd_HDR := $(addprefix src/,$(filter %.h,$(mpd_SOURCES)))
+mpd_OBJ := $(subst .c,.o,$(addprefix $(O)/,$(mpd_SRC)))
+mpd_DEP := $(subst .o,.d,$(mpd_OBJ))
+DIRS := $(O)/src/inputPlugins $(O)/src/audioOutputs
+HDR_DEP_HACK := $(addprefix $(0), $(mpd_HDR))
+export HDR_DEP_HACK
+
+dbg:
+ @echo mpd_OBJ $(mpd_OBJ)
+ @echo mpd_SRC $(mpd_SRC)
+ @echo mpd_DEP $(mpd_DEP)
+
+dep: $(mpd_DEP)
+ @echo $(mpd_DEP)
+
+$(O)/deftypes: bs/deftypes.c
+ $(CC) $(CFLAGS) -o $@+ $<
+ if test "$(HOST)" != "$(TARGET)"; then \
+ cp bs/deftypes-cross.sh $@+ && chmod +x $@+; fi
+ mv $@+ $@
+
+$(O)/config.h: $(O)/deftypes $(O)/config.mk
+ @-test -f $@ && mv $@ $@~
+ ./bs/mkconfig_header.sh > $@+ && $(O)/deftypes >> $@+ && mv $@+ $@
+
+config: $(O)/config.h
+$(O)/config.mk:
+ @mkdir -p $(DIRS) && >> $@
+
+-include $(O)/config.mk
+
+$(O)/src/%.d: src/%.c $(O)/config.h
+ ./bs/mkdep.sh $< > $@+ && mv $@+ $@
+
+include $(mpd_OBJ:.o=.d)
+
+$(O)/src/%.o: $(O)/src/%.d $(O)/config.h $(O)/config.mk
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@+ $< && mv $@+ $@
+
+