From ea82010fbfe1e306bb3d7fbd29057c0dc5c77e48 Mon Sep 17 00:00:00 2001 From: Elvira Khabirova Date: Sun, 12 Feb 2017 02:50:15 +0300 Subject: Clean up Makefiles --- Makefile | 39 +++++---------------------------------- config.mk | 7 +++++-- icebram/Makefile | 4 +--- icecompr/Makefile | 9 +++++---- icemulti/Makefile | 4 +--- icepack/Makefile | 4 +--- icepll/Makefile | 4 +--- iceprog/Makefile | 2 -- icetime/Makefile | 4 ++-- 9 files changed, 21 insertions(+), 56 deletions(-) diff --git a/Makefile b/Makefile index ffbc4bc..79e7a7f 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,11 @@ include config.mk -all: - $(MAKE) -C icebox - $(MAKE) -C icepack - $(MAKE) -C iceprog - $(MAKE) -C icemulti - $(MAKE) -C icepll - $(MAKE) -C icetime - $(MAKE) -C icebram +SUBDIRS = icebox icepack iceprog icemulti icepll icetime icebram -clean: - $(MAKE) -C icebox clean - $(MAKE) -C icepack clean - $(MAKE) -C iceprog clean - $(MAKE) -C icemulti clean - $(MAKE) -C icepll clean - $(MAKE) -C icetime clean - $(MAKE) -C icebram clean - -install: - $(MAKE) -C icebox install - $(MAKE) -C icepack install - $(MAKE) -C iceprog install - $(MAKE) -C icemulti install - $(MAKE) -C icepll install - $(MAKE) -C icetime install - $(MAKE) -C icebram install - -uninstall: - $(MAKE) -C icebox uninstall - $(MAKE) -C icepack uninstall - $(MAKE) -C iceprog uninstall - $(MAKE) -C icemulti uninstall - $(MAKE) -C icepll uninstall - $(MAKE) -C icetime uninstall - $(MAKE) -C icebram uninstall +all clean install uninstall: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir $@ || exit; \ + done mxebin: clean $(MAKE) MXE=1 diff --git a/config.mk b/config.mk index 9aec006..aeb525f 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,8 @@ -CXX ?= clang -CC ?= $(CXX) +CXX ?= clang++ +CC ?= clang +LDLIBS = -lm -lstdc++ +CFLAGS = -MD -O0 -ggdb -Wall -std=c99 -I/usr/local/include +CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include PKG_CONFIG ?= pkg-config DESTDIR ?= PREFIX ?= /usr/local diff --git a/icebram/Makefile b/icebram/Makefile index 827fe7c..d16b80b 100644 --- a/icebram/Makefile +++ b/icebram/Makefile @@ -1,6 +1,4 @@ include ../config.mk -LDLIBS = -lm -lstdc++ -CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include ifeq ($(STATIC),1) LDFLAGS += -static @@ -9,7 +7,7 @@ endif all: icebram$(EXE) icebram$(EXE): icebram.o - $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) + $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) test: icebram bash rundemo.sh diff --git a/icecompr/Makefile b/icecompr/Makefile index b230ffa..1c443f0 100644 --- a/icecompr/Makefile +++ b/icecompr/Makefile @@ -1,13 +1,14 @@ +include ../config.mk all: icecompr iceuncompr test: example_1k.ok example_8k.ok -icecompr: icecompr.cc - clang++ -o icecompr -Wall -Wextra -std=c++11 icecompr.cc +icecompr: icecompr.o + $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) -iceuncompr: iceuncompr.c - clang -o iceuncompr -Wall -Wextra iceuncompr.c +iceuncompr: iceuncompr.o + $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) %.compr: %.bin icecompr ./icecompr -v $< $@ diff --git a/icemulti/Makefile b/icemulti/Makefile index 009889e..a168bac 100644 --- a/icemulti/Makefile +++ b/icemulti/Makefile @@ -1,6 +1,4 @@ include ../config.mk -LDLIBS = -lm -lstdc++ -CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 ifeq ($(STATIC),1) LDFLAGS += -static @@ -9,7 +7,7 @@ endif all: icemulti$(EXE) icemulti$(EXE): icemulti.o - $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) + $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) install: all mkdir -p $(DESTDIR)$(PREFIX)/bin diff --git a/icepack/Makefile b/icepack/Makefile index cfe48be..2578fe0 100644 --- a/icepack/Makefile +++ b/icepack/Makefile @@ -1,6 +1,4 @@ include ../config.mk -LDLIBS = -lm -lstdc++ -CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include MXEGCC = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc ifeq ($(STATIC),1) @@ -10,7 +8,7 @@ endif all: icepack$(EXE) iceunpack$(EXE) icepack$(EXE): icepack.o - $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) + $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) iceunpack: icepack ln -sf icepack iceunpack diff --git a/icepll/Makefile b/icepll/Makefile index e0badf6..4efa4e1 100644 --- a/icepll/Makefile +++ b/icepll/Makefile @@ -1,6 +1,4 @@ include ../config.mk -LDLIBS = -lm -lstdc++ -CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include ifeq ($(STATIC),1) LDFLAGS += -static @@ -9,7 +7,7 @@ endif all: icepll$(EXE) icepll$(EXE): icepll.o - $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) + $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) install: all mkdir -p $(DESTDIR)$(PREFIX)/bin diff --git a/iceprog/Makefile b/iceprog/Makefile index 5614646..286460f 100644 --- a/iceprog/Makefile +++ b/iceprog/Makefile @@ -2,11 +2,9 @@ include ../config.mk ifneq ($(shell uname -s),Darwin) LDLIBS = -L/usr/local/lib -lm - CFLAGS = -MD -O0 -ggdb -Wall -std=c99 -I/usr/local/include else LIBFTDI_NAME = $(shell $(PKG_CONFIG) --exists libftdi1 && echo ftdi1 || echo ftdi) LDLIBS = -L/usr/local/lib -l$(LIBFTDI_NAME) -lm - CFLAGS = -MD -O0 -ggdb -Wall -std=c99 -I/usr/local/include endif ifeq ($(STATIC),1) diff --git a/icetime/Makefile b/icetime/Makefile index cfa7ff0..f30a42a 100644 --- a/icetime/Makefile +++ b/icetime/Makefile @@ -1,6 +1,6 @@ include ../config.mk LDLIBS = -lm -lstdc++ -CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include -DPREFIX='"$(PREFIX)"' -DCHIPDB_SUBDIR='"$(CHIPDB_SUBDIR)"' +override CXXFLAGS += -DPREFIX='"$(PREFIX)"' -DCHIPDB_SUBDIR='"$(CHIPDB_SUBDIR)"' ifeq ($(STATIC),1) LDFLAGS += -static @@ -9,7 +9,7 @@ endif all: icetime$(EXE) icetime$(EXE): icetime.o - $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) + $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) icetime.o: icetime.cc timings.inc -- cgit v1.2.3