Browse Source

updated Makefiles to build in subdirectories

master
Sven Oliver Moll 1 month ago
parent
commit
c94a12f3cc
4 changed files with 25 additions and 15 deletions
  1. 2
    0
      .gitignore
  2. 13
    9
      Makefile
  3. 9
    5
      Makefile.mxe
  4. 1
    1
      debian/install

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+mxe
2
+obj

+ 13
- 9
Makefile View File

@@ -1,19 +1,23 @@
1 1
 
2 2
 PROGRAM = makewav
3 3
 
4
-CC = gcc
5
-CFLAGS = -Os -g -Wall
6
-#CFLAGS = -g -Wall
7
-LDFLAGS = -lm -lportaudio
4
+CC       := gcc
5
+CFLAGS   := -Os -g -Wall
6
+#CFLAGS   := -g -Wall
7
+LDFLAGS  := -lm -lportaudio
8
+BUILDDIR := obj
8 9
 
9
-all: $(PROGRAM)
10
+all: $(BUILDDIR)/$(PROGRAM)
10 11
 
11
-%.o: %.c
12
-	$(CC) $(CFLAGS) -c -o $@ $^
12
+$(BUILDDIR):
13
+	mkdir -p $@
13 14
 
14
-$(PROGRAM): queue.o makewav.o paplay.o streambuffer.o
15
+$(BUILDDIR)/%.o: %.c $(BUILDDIR)
16
+	$(CC) $(CFLAGS) -c -o $@ $<
17
+
18
+$(BUILDDIR)/$(PROGRAM): $(BUILDDIR)/queue.o $(BUILDDIR)/makewav.o $(BUILDDIR)/paplay.o $(BUILDDIR)/streambuffer.o
15 19
 	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
16 20
 
17 21
 clean:
18
-	rm -f $(PROGRAM) *.o
22
+	rm -rf $(BUILDDIR)
19 23
 

+ 9
- 5
Makefile.mxe View File

@@ -9,18 +9,22 @@ STRIP      := $(MXE_DIR)/usr/bin/$(MXE_TARGET)-strip
9 9
 CFLAGS     := -Os
10 10
 #CFLAGS     := -g -Wall
11 11
 LDFLAGS    := -lm -lportaudio -lwinmm -lsetupapi -lhid -lole32
12
+BUILDDIR   := mxe
12 13
 
13
-all: $(PROGRAM)
14
+all: $(BUILDDIR)/$(PROGRAM)
14 15
 
15
-%.o: %.c
16
-	$(CC) $(CFLAGS) -c -o $@ $^
16
+$(BUILDDIR):
17
+	mkdir -p $@
17 18
 
18
-$(PROGRAM): queue.o makewav.o paplay.o streambuffer.o
19
+$(BUILDDIR)/%.o: %.c $(BUILDDIR)
20
+	$(CC) $(CFLAGS) -c -o $@ $<
21
+
22
+$(BUILDDIR)/$(PROGRAM): $(BUILDDIR)/queue.o $(BUILDDIR)/makewav.o $(BUILDDIR)/paplay.o $(BUILDDIR)/streambuffer.o
19 23
 	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
20 24
 	$(STRIP) $@
21 25
 	upx --ultra-brute $@ || :
22 26
 	ls -l $@
23 27
 
24 28
 clean:
25
-	rm -f $(PROGRAM) *.o
29
+	rm -rf $(BUILDDIR)
26 30
 

+ 1
- 1
debian/install View File

@@ -1 +1 @@
1
-makewav usr/bin
1
+obj/makewav usr/bin

Loading…
Cancel
Save