diff --git a/Makefile b/Makefile index 6941b2c..620c56e 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ PACKAGE = c99 VERSION = 0.0.0 SUBDIRS = include src -RM = rm -f -LN = ln -f -TAR = tar -czvf +RM ?= rm -f +LN ?= ln -f +TAR ?= tar -czvf all: subdirs diff --git a/include/Makefile b/include/Makefile index 2531d7a..ad4096c 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,10 +1,10 @@ SUBDIRS = c99 PREFIX = /usr/local DESTDIR = -RM = rm -f -LN = ln -f -MKDIR = mkdir -p -INSTALL = install +RM ?= rm -f +LN ?= ln -f +MKDIR ?= mkdir -p +INSTALL ?= install INCLUDEDIR= $(PREFIX)/include diff --git a/include/c99/Makefile b/include/c99/Makefile index 4c46c10..0faa60c 100644 --- a/include/c99/Makefile +++ b/include/c99/Makefile @@ -1,9 +1,9 @@ PREFIX = /usr/local DESTDIR = -RM = rm -f -LN = ln -f -MKDIR = mkdir -p -INSTALL = install +RM ?= rm -f +LN ?= ln -f +MKDIR ?= mkdir -p +INSTALL ?= install INCLUDEDIR= $(PREFIX)/include diff --git a/src/Makefile b/src/Makefile index 643cf83..8d4f700 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,10 +10,10 @@ CFLAGSF = -W `pkg-config --cflags cpp` CFLAGS = -Wall -g -O2 -pedantic LDFLAGSF= `pkg-config --libs cpp` LDFLAGS = -L$(PREFIX)/lib -Wl,-rpath,$(PREFIX)/lib -RM = rm -f -LN = ln -f -MKDIR = mkdir -p -INSTALL = install +RM ?= rm -f +LN ?= ln -f +MKDIR ?= mkdir -p +INSTALL ?= install all: subdirs $(TARGETS) diff --git a/src/target/Makefile b/src/target/Makefile index ea72e76..88c8657 100644 --- a/src/target/Makefile +++ b/src/target/Makefile @@ -8,13 +8,13 @@ CPPFLAGS= CFLAGSF = -W `pkg-config --cflags cpp` CFLAGS = -Wall -g -O2 -fPIC -pedantic LDFLAGSF= `pkg-config --libs cpp` -AR = ar -rc -RANLIB = ranlib -LD = $(CC) -shared -RM = rm -f -LN = ln -f -MKDIR = mkdir -p -INSTALL = install +AR ?= ar +RANLIB ?= ranlib +CCSHARED?= $(CC) -shared +RM ?= rm -f +LN ?= ln -f +MKDIR ?= mkdir -p +INSTALL ?= install all: $(TARGETS) @@ -24,21 +24,21 @@ asm_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) `pkg-config --cflags asm_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs asm` asm.so: $(asm_OBJS) - $(LD) -o asm.so $(asm_OBJS) $(asm_LDFLAGS) + $(CCSHARED) -o asm.so $(asm_OBJS) $(asm_LDFLAGS) graph_OBJS = graph.o graph_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) graph_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) graph.so: $(graph_OBJS) - $(LD) -o graph.so $(graph_OBJS) $(graph_LDFLAGS) + $(CCSHARED) -o graph.so $(graph_OBJS) $(graph_LDFLAGS) indent_OBJS = indent.o indent_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) indent_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) indent.so: $(indent_OBJS) - $(LD) -o indent.so $(indent_OBJS) $(indent_LDFLAGS) + $(CCSHARED) -o indent.so $(indent_OBJS) $(indent_LDFLAGS) asm.o: asm.c ../../include/c99/target.h ../../config.h $(CC) $(asm_CFLAGS) -c asm.c