Results 1 to 2 of 2
I am banging my head trying to get a certain kind of Makefile to work. Here is what I have so far. Code: CXX = g++ LIBS = -L$(SYSTEMC_HOME)/lib-$(TARGET_ARCH) -lsystemc ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-20-2012 #1
- Join Date
- Jun 2005
I am banging my head trying to get a certain kind of Makefile to work. Here is what I have so far.
CXX = g++ LIBS = -L$(SYSTEMC_HOME)/lib-$(TARGET_ARCH) -lsystemc INC = -I$(SYSTEMC_HOME)/include SOURCES = file1.cpp file2.cpp OBJS:=$(SOURCES:%.cpp=%.o) all:$(OBJS) file1.o: $(CXX) $(INC) -c file1.cpp file2.o: $(CXX) $(INC) -c file2.cpp .PHONY: clean clean: rm -f *.o
- 11-20-2012 #2
- Join Date
- Jun 2012
- SF Bay area
Here's a Makefile I came up with a couple of months ago that seems related to what you're trying to do. I can just add a program name to the list at the time and all the rules to compile and link work for whichever one I "make". You might be able to copy bits and pieces out.
PROGS = capture-udp-port send-udp-message capture-udpv6-port send-udpv6-message capture-udp-port-hex capture-udpv6-port-hex # --- CC = gcc LD = gcc CFLAGS = -g -Wall -pedantic LDFLAGS = # --- default: @echo "You can make any of the following programs: $(PROGS)" # --- .PHONY: all all: $(PROGS) # --- %.o : %.c Makefile $(CC) -c -o $@ $(CFLAGS) $< $(PROGS) : % : %.o $(CC) -o $@ $(@).o $(LDFLAGS) # --- clean: rm $(PROGS) *.o