Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # list of all executables that need to be compiled, you should have .c files with these names
- EXE = main
- # compiler command
- CC = gcc
- # all shared libraries will be copied in this directory
- LDIR = lib
- # all intermediate files (e.g. .o files) will be located in this folder
- TMPDIR = tmp
- # basic gcc flags for compiling executables
- CFLAGS = -Wall -c -std=c99 $$(mysql_config --cflags --libs)
- LFLAGS = -L./$(LDIR) -Wl,-rpath=./$(LDIR)
- # basic gcc flags for compiling shared libraries
- CDFLAGS = -Wall -c -std=c99 -fPIC -o $(TMPDIR)/$@ $< $$(mysql_config --cflags --libs)
- # basic gcc flags for linking shared libraries
- LDFLAGS = -shared -o $(LDIR)/$@ $(TMPDIR)/$<
- # Main target when executing make. Compile all files listed in the EXE variable
- all: main.c myqueue.c tcpsocket.c sensor_db.c datamgr.c
- $(CC) -pthread -std=c99 main.c myqueue.c tcpsocket.c sensor_db.c datamgr.c -DSET_MAX_TEMP=14 -DSET_MIN_TEMP=10 -llist -L./lib -Wl,-rpath=./lib $(mysql_config --cflags --libs) -o $(EXE)
- ./$(EXE)
- clean:
- rm -f *~ *.o $(EXE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement